API Documentation
Public Member Functions | List of all members
nkGraphics::BoundingBox Class Referencefinal

A bounding box. Often used to encompass object's bounds in the world. More...

Public Member Functions

 BoundingBox ()
 
 BoundingBox (const nkMaths::Vector &center, float cubeHalfSide)
 
 BoundingBox (const nkMaths::Vector &center, const nkMaths::Vector &axisAlignedHalfSides)
 
 ~BoundingBox ()
 
const std::array< nkMaths::Vector, 8 > & getPoints () const
 
const std::array< nkMaths::Vector, 8 > & getTransformedPoints () const
 
nkMaths::Vector getCenter () const
 
nkMaths::Vector getAxisAlignedSides () const
 
void setPoints (const std::array< nkMaths::Vector, 8 > &points)
 
void updateTransformation (Node *node)
 
bool checkAgainst (const Frustum &frustum) const
 

Detailed Description

A bounding box. Often used to encompass object's bounds in the world.

Can be used to check against a frustum and do culling.

Constructor & Destructor Documentation

◆ BoundingBox() [1/3]

nkGraphics::BoundingBox::BoundingBox ( )

Default constructor.

◆ BoundingBox() [2/3]

nkGraphics::BoundingBox::BoundingBox ( const nkMaths::Vector center,
float  cubeHalfSide 
)

Constructor.

Parameters
centerThe center of the box to create.
cubeHalfSideThe half extent, uniform along the 3 axis (x, y, z), used to form a cube.

◆ BoundingBox() [3/3]

nkGraphics::BoundingBox::BoundingBox ( const nkMaths::Vector center,
const nkMaths::Vector axisAlignedHalfSides 
)

Constructor.

Parameters
centerThe center of the box to create.
axisAlignedHalfSidesThe half extents, for each axis.

◆ ~BoundingBox()

nkGraphics::BoundingBox::~BoundingBox ( )

Destructor.

Member Function Documentation

◆ getPoints()

const std::array<nkMaths::Vector, 8>& nkGraphics::BoundingBox::getPoints ( ) const
Returns
The 8 points forming the box, originally.

◆ getTransformedPoints()

const std::array<nkMaths::Vector, 8>& nkGraphics::BoundingBox::getTransformedPoints ( ) const
Returns
The 8 points forming the box, once transformed by a node transformation.

◆ getCenter()

nkMaths::Vector nkGraphics::BoundingBox::getCenter ( ) const
Returns
The center of the box.

◆ getAxisAlignedSides()

nkMaths::Vector nkGraphics::BoundingBox::getAxisAlignedSides ( ) const
Returns
The half extent on the 3 axis of the box.

◆ setPoints()

void nkGraphics::BoundingBox::setPoints ( const std::array< nkMaths::Vector, 8 > &  points)

Sets new points to use for the box.

Parameters
pointsThe points to use.

◆ updateTransformation()

void nkGraphics::BoundingBox::updateTransformation ( Node node)

Updates the transformed points with a node transformation.

Parameters
nodeThe node from which to retrieve the transformation.

◆ checkAgainst()

bool nkGraphics::BoundingBox::checkAgainst ( const Frustum frustum) const

Checks the box against a frustum to know if it is inside or not.

Parameters
frustumThe frustum to check against.
Returns
If the box is inside the frustum (true) or not (false).

The documentation for this class was generated from the following file: